<?php
/**
 * Created by PhpStorm.
 * User: Ason
 * Date: 15-6-30
 * Time: 上午9:43
 *
 * 附件管理
 */
class Upfile extends Admin_controller{

	public function __construct(){
		parent::__construct();
		parent::logged_check();
	}

	/**
	 * 附件管理
	 * */
	public function index(){

		$this->load->view( 'upfile/index', $this->data );
	}

	/**
	*获取文件系统路径结构
	*
	*/

	public function get_tree( $folder=0 ){

		if( $folder){
			$json = json_decode('{
						"status": "OK",
						"data": [{
							"id": 1,
							"name": "label 1",
							"type": "folder",
							"additionalParameters": {
								"id": 1,
								"children": true,
								"itemSelected": false
							}
						},
						{
							"id": 2,
							"name": "label 2",
							"type": "item",
							"additionalParameters": {
								"id": 2,
								"children": false,
								"itemSelected": false
							}
						},
						{
							"id": 3,
							"name": "label 3",
							"type": "item",
							"additionalParameters": {
								"id": 3,
								"children": false,
								"itemSelected": false
							}
						}]
					}');
		}else{
			$json = json_decode('{
						"status": "OK",
						"data": [{
							"id": 1,
							"name": "子文件夹1",
							"type": "folder",
							"additionalParameters": {
								"id": 1,
								"children": true,
								"itemSelected": false
							}
						},
						{
							"id": 2,
							"name": "文件1",
							"type": "item",
							"additionalParameters": {
								"id": 2,
								"children": false,
								"itemSelected": false
							}
						}]
					}');
		}
		
		die( json_encode($json) );
	}
}
